bitkeeper revision 1.1274.1.1 (4252c316ZtQV7eOqUOayWDXp7qfbJw)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 5 Apr 2005 16:55:50 +0000 (16:55 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 5 Apr 2005 16:55:50 +0000 (16:55 +0000)
Clean up shadow code presence in common source files.
Signed-off-by: Keir Fraser <keir@xensource.com>
.rootkeys
xen/common/dom0_ops.c
xen/common/dom_mem_ops.c
xen/common/domain.c
xen/common/grant_table.c
xen/common/page_alloc.c
xen/include/asm-ia64/shadow.h [deleted file]
xen/include/asm-x86/shadow.h
xen/include/xen/perfc.h
xen/include/xen/shadow.h [new file with mode: 0644]

index cc381c8f5e10fa1b75e23c2fcc61bc09e881ba59..3334f34268366e75ffdb632660cf3fc3c8bbe4f4 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 421098b7Z6OwjZnrTZkh34DoDfcjrA xen/include/asm-ia64/regionreg.h
 421098b707cY5YluUcWK5Pc-71ETVw xen/include/asm-ia64/regs.h
 4214e2f3fbO_n9Z1kIcBR83d7W4OJw xen/include/asm-ia64/serial.h
-421098b7czhvyPGFa5nskL0N4vNvFw xen/include/asm-ia64/shadow.h
 421098b7GkWOnlzSmPvNAhByOSZ1Dw xen/include/asm-ia64/time.h
 421098b7FK3xgShpnH0I0Ou3O4fJ2Q xen/include/asm-ia64/tlb.h
 421098b78IGdFOGUlPmpS7h_QBmoFg xen/include/asm-ia64/vcpu.h
 40589969nPq3DMzv24RDb5LXE9brHw xen/include/xen/sched-if.h
 3ddb79c0LzqqS0LhAQ50ekgj4oGl7Q xen/include/xen/sched.h
 403a06a7H0hpHcKpAiDe5BPnaXWTlA xen/include/xen/serial.h
+4252c315hw0xXYMKIfFzhomi1M1yNA xen/include/xen/shadow.h
 3ddb79c14dXIhP7C2ahnoD08K90G_w xen/include/xen/slab.h
 3ddb79c09xbS-xxfKxuV3JETIhBzmg xen/include/xen/smp.h
 3ddb79c1Vi5VleJAOKHAlY0G2zAsgw xen/include/xen/softirq.h
index 0c6bb484e0b6e28d1784f53bbbad7d7c474104e9..2df3dda433c5d693dbbe06ad822549762f3b079b 100644 (file)
@@ -17,7 +17,6 @@
 #include <xen/trace.h>
 #include <xen/console.h>
 #include <xen/physdev.h>
-#include <asm/shadow.h>
 #include <public/sched_ctl.h>
 
 #define TRC_DOM0OP_ENTER_BASE  0x00020000
index d1f4d393022b543472108601b6d29c2240522d9d..e8e3b7b25621075937d9218c58ae9208f9740173 100644 (file)
@@ -13,8 +13,8 @@
 #include <xen/perfc.h>
 #include <xen/sched.h>
 #include <xen/event.h>
+#include <xen/shadow.h>
 #include <asm/domain_page.h>
-#include <asm/shadow.h>
 
 /*
  * To allow safe resume of do_dom_mem_op() after preemption, we need to know 
@@ -112,26 +112,7 @@ free_dom_mem(struct domain *d,
             if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
                 put_page(page);
 
-            if ( unlikely(shadow_mode_enabled(d)) )
-            {
-                // XXX This needs more thought.  This isn't pretty,
-                // and it's not fast.  But it's a place holder.
-                //
-                shadow_lock(d);
-                if ( page_out_of_sync(page) )
-                    __shadow_sync_mfn(d, mpfn + j);
-                shadow_remove_all_access(d, mpfn + j);
-
-                if (page->count_info != 1)
-                {
-                    printk("free_dom_mem in shadow mode didn't release page "
-                           "mfn=%p c=%p\n", mpfn+j, page->count_info);
-                    shadow_unlock(d);
-                    audit_domain(d);
-                    BUG();
-                }
-                shadow_unlock(d);
-            }
+            shadow_sync_and_drop_references(d, page);
 
             put_page(page);
         }
index dff6c033afd0329d8ac27a1234e2c100edd43143..81a395373977731ef7509ed0ca63275399c36fea 100644 (file)
@@ -15,7 +15,6 @@
 #include <xen/time.h>
 #include <xen/console.h>
 #include <xen/softirq.h>
-#include <asm/shadow.h>
 #include <public/dom0_ops.h>
 #include <asm/domain_page.h>
 #include <asm/debugger.h>
index 14648c3affac01c3807bac1798e7e2c0a581c51b..5522b44a82d5fc8934c2750fd5b11a23ae7c2e69 100644 (file)
@@ -27,8 +27,8 @@
 
 #include <xen/config.h>
 #include <xen/sched.h>
-#include <asm/mm.h>
-#include <asm/shadow.h>
+#include <xen/shadow.h>
+#include <xen/mm.h>
 
 #define PIN_FAIL(_lbl, _rc, _f, _a...)   \
     do {                           \
index ddbed436204f9c250c53983496c968612fffd749..5df70a0ad26dc7ce41191c79c14af1a6d86806e3 100644 (file)
@@ -30,9 +30,9 @@
 #include <xen/slab.h>
 #include <xen/irq.h>
 #include <xen/softirq.h>
+#include <xen/shadow.h>
 #include <asm/domain_page.h>
 #include <asm/page.h>
-#include <asm/shadow.h>
 
 /*
  * Comma-separated list of hexadecimal page numbers containing bad bytes.
@@ -561,22 +561,7 @@ void free_domheap_pages(struct pfn_info *pg, unsigned int order)
 
         for ( i = 0; i < (1 << order); i++ )
         {
-            if ( ((pg[i].u.inuse.type_info & PGT_count_mask) != 0) &&
-                shadow_mode_enabled(d) )
-            {
-                // XXX This needs more thought...
-                //
-                printk("%s: needing to call shadow_remove_all_access for mfn=%p\n",
-                       __func__, page_to_pfn(&pg[i]));
-                printk("Amfn=%p c=%p t=%p\n", page_to_pfn(&pg[i]),
-                       pg[i].count_info, pg[i].u.inuse.type_info);
-                shadow_lock(d);
-                shadow_remove_all_access(d, page_to_pfn(&pg[i]));
-                shadow_unlock(d);
-                printk("Bmfn=%p c=%p t=%p\n", page_to_pfn(&pg[i]),
-                       pg[i].count_info, pg[i].u.inuse.type_info);
-            }
-
+            shadow_drop_references(d, &pg[i]);
             ASSERT((pg[i].u.inuse.type_info & PGT_count_mask) == 0);
             pg[i].tlbflush_timestamp  = tlbflush_current_time();
             pg[i].u.free.cpu_mask     = d->cpuset;
diff --git a/xen/include/asm-ia64/shadow.h b/xen/include/asm-ia64/shadow.h
deleted file mode 100644 (file)
index a9f07b1..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-#define        shadow_lock_init(d)     do {} while(0)
-#define        shadow_mode_init(d)     do {} while(0)
index 4aa84b1d17b5e285a017d23e6aab58946e24b6d6..4659468f394db4132185720dddbafc0acc936d0a 100644 (file)
@@ -377,6 +377,52 @@ update_hl2e(struct exec_domain *ed, unsigned long va)
     }
 }
 
+static inline void shadow_drop_references(
+    struct domain *d, struct pfn_info *page)
+{
+    if ( likely(!shadow_mode_enabled(d)) ||
+         ((page->u.inuse.type_info & PGT_count_mask) == 0) )
+        return;
+
+    /* XXX This needs more thought... */
+    printk("%s: needing to call shadow_remove_all_access for mfn=%p\n",
+           __func__, page_to_pfn(page));
+    printk("Before: mfn=%p c=%p t=%p\n", page_to_pfn(page),
+           page->count_info, page->u.inuse.type_info);
+
+    shadow_lock(d);
+    shadow_remove_all_access(d, page_to_pfn(page));
+    shadow_unlock(d);
+
+    printk("After:  mfn=%p c=%p t=%p\n", page_to_pfn(page),
+           page->count_info, page->u.inuse.type_info);
+}
+
+static inline void shadow_sync_and_drop_references(
+    struct domain *d, struct pfn_info *page)
+{
+    if ( likely(!shadow_mode_enabled(d)) )
+        return;
+
+    /* XXX Needs more thought. Neither pretty nor fast: a place holder. */
+    shadow_lock(d);
+
+    if ( page_out_of_sync(page) )
+        __shadow_sync_mfn(d, page_to_pfn(page));
+
+    shadow_remove_all_access(d, page_to_pfn(page));
+
+    if ( page->count_info != 1 )
+    {
+        printk("free_dom_mem in shadow mode didn't release page "
+               "mfn=%p c=%p\n", page_to_pfn(page), page->count_info);
+        shadow_unlock(d);
+        audit_domain(d);
+        BUG();
+    }
+
+    shadow_unlock(d);
+}
 
 /************************************************************************/
 
index 108bf5982c81bba724c27c850c85605dc8dd72c2..6d758497b19b97e07aefe623cac98ae6567fec91 100644 (file)
@@ -111,7 +111,9 @@ extern struct perfcounter perfcounters;
 #define perfc_incr(x)     ((void)0)
 #define perfc_decr(x)     ((void)0)
 #define perfc_incrc(x)    ((void)0)
+#define perfc_decrc(x)    ((void)0)
 #define perfc_incra(x,y)  ((void)0)
+#define perfc_decra(x,y)  ((void)0)
 #define perfc_add(x,y)    ((void)0)
 #define perfc_addc(x,y)   ((void)0)
 #define perfc_adda(x,y,z) ((void)0)
diff --git a/xen/include/xen/shadow.h b/xen/include/xen/shadow.h
new file mode 100644 (file)
index 0000000..8379d4f
--- /dev/null
@@ -0,0 +1,18 @@
+
+#ifndef __XEN_SHADOW_H__
+#define __XEN_SHADOW_H__
+
+#include <xen/config.h>
+
+#ifdef CONFIG_X86
+
+#include <asm/shadow.h>
+
+#else
+
+#define shadow_drop_references(_d, _p)          ((void)0)
+#define shadow_sync_and_drop_references(_d, _p) ((void)0)
+
+#endif
+
+#endif /* __XEN_SHADOW_H__ */